<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <!--引入elementui样式类-->
    <link rel="stylesheet" href="/css/index.css">
    <link rel="stylesheet" href="/js/index.css">
    <script src="/js/jquery-3.2.1.js"></script>
</head>
<body>
    <div id="app">
        <h2>资产报废</h2>
        每年折旧25%,四年这个机器就报废了!<br>
        <el-button type="primary" @click="handleDepreciation">资产折旧</el-button>
    </div>
</body>
<!-- import Vue before Element -->
<script src="/js/vue.js"></script>
<!-- import JavaScript -->
<script src="/js/index.js"></script>
<script src="/js/axios.min.js"></script>
<script>
    new Vue({
        el: '#app',
        data: function () {
            return {

            }
        },
        methods: {
            //资产折旧
            handleDepreciation(){
                //定义要传递的参数
                let params=new URLSearchParams();
                //发送故障请求
                axios.post('asset/depreciation',params).then((res)=>{
                    //判断是否成功
                    if(res.data==1){
                        //资产折旧成功后,给予提示
                        this.$message('提示，资产折旧成功');
                    }else if(res.data==0){
                        this.$message.error('错误提示，资产折旧失败');
                    }
                }).catch((err)=>{
                    //输出错误消息
                    console.info(err);
                });
            }
        },
    })
</script>
</html>
